﻿/*
 * LINQ to LDAP
 * http://linqtoldap.codeplex.com/
 * 
 * Copyright Alan Hatter (C) 2010-2012
 * alan.hatter@gmail.com - http://hattercoding.blogspot.com/
 * 
 * This project is subject to licensing restrictions. Visit http://linqtoldap.codeplex.com/license for more information.
 */

using System.DirectoryServices.Protocols;

namespace LinqToLdap.QueryCommands.Options
{
    internal class SortingOptions : ISortingOptions
    {
        private readonly SortKey _sortKey;
        public SortingOptions(string attributeName, bool descending)
        {
            _sortKey = new SortKey {AttributeName = attributeName, ReverseOrder = descending};
        }

        public void SetMatchingRule(string matchingRule)
        {
            _sortKey.MatchingRule = matchingRule;
        }

        public SortKey[] Keys { get { return new[] {_sortKey}; } }
    }
}
